package com.demo.activityservicedemo.demo2

import android.app.Service
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.IBinder
import android.os.Looper
import android.os.Message
import android.os.Messenger
import android.util.Log

/**
 * Created by zhangyuncai on 2024/6/27.
 */
class Demo2Service : Service() {
    class IncomingHandler : Handler(Looper.getMainLooper()) {
        override fun handleMessage(msg: Message) {
            val bundle = msg.data as Bundle
            Log.e("test:", "bundle:${bundle.getString("test")}")
        }
    }

    var mMessage = Messenger(IncomingHandler())
    override fun onBind(intent: Intent?): IBinder? {
        return mMessage.binder
    }
}